// 模块1
console.log( '模块1...' );

// export命令，用于导出某个模块的接口/功能

/* // 场景1
function fn1(a,b){
    console.log( a+b );
}
export {fn1}; */


/* // 场景2（不推荐）
export let name = '张三';
export let age = 23;
export let sex = '男';
export function say(){
    console.log( 'hi' );
} */


/* // 场景3（推荐）
let name = '李四';
let age =24;
let sex = '女';
function say(){
    console.log( 'hi' );
}
export {name,age,sex,say}; */


/* // 场景4
function test1(){
    console.log( 'test1...' );
}
function test2(){
    console.log( 'test2...' );
}
// 使用 as 关键字，修改输出变量的名称
export {
    test1 as fn1,
    test2 as fn2,
    test2 as fn3
} */


/* // 场景5
let name = '王五';
let age =25;
let sex = '女';
function say(){
    console.log( 'hi' );
}
export {name,age,sex,say}; */


/* // 场景6
let num = 123;
let obj = {
    name: '老王',
    sex: '男',
    age: 38
}
export {num,obj}; */


/* // 场景7
// 每一个模块都可以有且仅有一个默认导出！
let a = 123;
let b = 'abc';
export default function show(){
    console.log( '函数...' );
}
export {a,b}; */


/* // 场景8
let name = '王五';
let age =25;
let sex = '女';
function say(){
    console.log( 'hi' );
}
export {name,age,sex,say};
export default {
    name: '马六',
    age: 26,
    sex: '女'
} */


/* // 场景9
let num = 123;
setTimeout(()=>{
    num = 456;
},1000);
export {num}; */


// // 场景10
// function test(){
//     console.log( this );// undefined
// }
// export {test};


/* // 场景11
// 模块不需要输出任何内容，只需要执行
let a = 10;
let b = 20;
function fun(x,y){
    console.log( x+y );
}
fun(a,b); */


// 一些注意事项：

/* // 正确的写法：
export let a = 1;

let b = 2;
export {b};

let c = 3;
export {c as d};

export function fn1(){};

function fn2(){}
export {fn2};

export default 4;

export default function (){}

export default {}

let abc = 123;
export default abc; */

/* // 错误的写法：
export 123;

let num1 = 123;
export num1;

function fn1(){}
export fn1;

export {a:1,b:2};

export default let num2 = 456; */

